package org.zfes.snowier.cloud.zbss.cms.router.service.topic;

import java.util.Map;
import java.util.Optional;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.zfes.snowier.core.data.DataSet;
import org.zfes.snowier.web.controller.BaseController;
import org.zfes.snowier.cloud.zbss.cms.topic.model.CmsTopicModel;
import org.zfes.snowier.cloud.zbss.cms.topic.service.ICmsTopicModelService;
@Controller 
@RequestMapping("/cms/topic/cmsTopicModle")
public class CmsTopicModleController extends BaseController {

	
	@Autowired
	private ICmsTopicModelService cmsTopicModelService;
	
	@RequiresPermissions(value="cmsTopicModel:loadCmsTopicModleDataSet",desc="专题模型列表")
    @RequestMapping(value="/loadCmsTopicModelDataSet", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
    public @ResponseBody  Object loadCmsTopicModleDataSet(@RequestParam Map<String,Object> params){
	    DataSet dataSet=  cmsTopicModelService.loadCmsTopicModelDataSet(params);
	    return ajaxQuery("dataSet", dataSet);
    }
	
	@RequiresPermissions(value="cmsTopicModel:createCmsTopicModle",desc="专题模型添加")
    @RequestMapping(value="/createCmsTopicModel", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
    public  @ResponseBody Object createCmsTopicModle(CmsTopicModel cmsTopicModel){
		cmsTopicModelService.createCmsTopicModel(cmsTopicModel);
    	return ajaxDoneSuccess("数据操作成功 ");
    }
	
	@RequiresPermissions(value="cmsTopicModel:loadCmsTopicModle",desc="专题模型加载")
    @RequestMapping(value="/loadCmsTopicModel", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
    public @ResponseBody  Object loadCmsTopicModle(Long id){
		Optional<CmsTopicModel> ops = cmsTopicModelService.loadCmsTopicModelById(id);
		return ajaxQuery("cmsTopicModel",ops);
    }
	
	@RequiresPermissions(value="cmsTopicModel:updateCmsTopicModel",desc="专题模型更新")
    @RequestMapping(value="/updateCmsTopicModel", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
    public @ResponseBody  Object updateCmsTopicModle(CmsTopicModel cmsTopicModel){
		cmsTopicModelService.updateCmsTopicModel(cmsTopicModel);
		return ajaxDoneSuccess("数据操作成功 ");
    }
	
	@RequiresPermissions(value="cmsTopicModel:deletCmsTopicModle",desc="专题模型删除")
    @RequestMapping(value="/deleteCmsTopicModel", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
    public @ResponseBody  Object deleteCmsTopicModle(Long id){
		cmsTopicModelService.deleteCmsTopicModel(id);
		return ajaxDoneSuccess("数据操作成功 ");
    }

}